<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
      .box{
        width: 100px;
        height: 100px;
        background-color: orange;
        margin-bottom: 10px;
      }
    </style>
</head>
<body>
    <div id="app">
      <!-- 1.完整的写法 -->
        <div class="box" v-on:click="divClick"></div>

      <!-- 2.语法糖写法 -->
        <div class="box" @click="divClick"></div>

      <!-- 3.绑定的方法位置，也可以写成一个表达式（不常用） -->
      <h2>{{ counter }}</h2>
      <button @click="increment">+1</button>

      <!-- 不推荐 -->
      <button @click="counter++">+1</button>

      <!-- 4.绑定其他方法 -->
      <div class="box" @mousemove="divmousemove"></div>

      <!-- 5.元素绑定多个事件 -->
      <!-- 这两个效果相同 -->
      <div class="box" @click="divClick" @mousemove="divmousemove"></div>
      <div class="box" v-on="{click: divClick,mousemove: divmousemove}"></div>


    </div>

    <script src="./lib/Vue.js"></script>
    <script>
        const app = Vue.createApp({
            data() {
                return{
                  counter:0
                }
            },
            methods: {
              divClick() {
                console.log('divClick');
              },
              increment() {
                this.counter++
              },
              divmousemove(){
                console.log('divmousemove');
              }
            }
        })
        app.mount("#app")
    </script>
</body>
</html>